package com.success.application.widget;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.lang.reflect.Type;

/**
 * Created by ChrisWong on 2017/2/6.
 */

public class GsonUtils {

    public static <T> T fromJson(String str, Type type){
        return createGson().fromJson(str,type);
    }

    private static Gson createGson() {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
        return gsonBuilder.create();
    }
}
